<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>团体认证</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="../../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script src="../../js/base.js"></script>
    <script src="../../js/jquery.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>

    </style>
</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <input id="dataId" hidden data-id="dataId">
            <input id="Showwat" hidden data-id="Showwat">
            <div class="layui-form-item">
                <label for="nickName" class="layui-form-label">用户名称</label>
                <div class="layui-input-inline">
                    <div id="nickName"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="name" class="layui-form-label">真实姓名</label>
                <div class="layui-input-inline">
                    <div id="name"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="sex" class="layui-form-label">性别</label>
                <div class="layui-input-inline">
                    <div id="sex"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="birthDay" class="layui-form-label">出生日期</label>
                <div class="layui-input-inline">
                    <div id="birthDay"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="identity" class="layui-form-label">身份</label>
                <div class="layui-input-inline">
                    <div id="identity"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="documentType" class="layui-form-label">证件类型</label>
                <div class="layui-input-inline">
                    <div id="documentType"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="documentNumber" class="layui-form-label">证件号码</label>
                <div class="layui-input-inline">
                    <div id="documentNumber"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="city" class="layui-form-label">城市</label>
                <div class="layui-input-inline">
                    <div id="city"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="area" class="layui-form-label">地区</label>
                <div class="layui-input-inline">
                    <div id="area"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="address" class="layui-form-label">通信地址</label>
                <div class="layui-input-inline">
                    <div id="address"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="introduction" class="layui-form-label">个人简介</label>
                <div class="layui-input-inline">
                    <div id="introduction"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="headPortraitUrl" class="layui-form-label">头像</label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <img src="" id="headPortraitUrl" style="width: 100%;height: 100%">
                    </div>
                </div>
            </div>

            <div class="layui-form-item" id="chakany">
                <label for="status" class="layui-form-label">
                    <span class="x-red">*</span>认证结果
                </label>
                <div class="layui-input-block">
                    <input type="radio"
                           lay-filter="isPassTest"
                           name="isPassTest"
                           id="isPassTest1" value="1"
                           title="通过">
                    <div class="layui-unselect layui-form-radio layui-form-radioed">
                        <div>通过</div>
                    </div>
                    <input type="radio"
                           lay-filter="isPassTest"
                           name="isPassTest"
                           id="isPassTest2" value="2"
                           title="失败">
                    <div class="layui-unselect layui-form-radio">
                        <div>失败</div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="reasonDiv" style="display: none">
                <label for="reason" class="layui-form-label">
                    失败原因
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <input type="text"
                               value="" id="reason" class="layui-input" placeholder="请输入失败原因">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="jieguoBox">
                <label for="jieguo" class="layui-form-label">认证结果</label>
                <div class="layui-input-inline">
                    <div id="jieguo"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="yuanyinBox">
                <label for="yuanyin" class="layui-form-label">失败原因</label>
                <div class="layui-input-inline">
                    <div id="yuanyin"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 30px;height: 30px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="text-align: center;display:none" id="btn">
                <button type="submit" lay-filter="add" lay-submit="" class="layui-btn">确定</button>
                <button type="button" class="layui-btn layui-btn-primary" onclick="xadmin.close()">取消</button>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer', 'laydate'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#date', //指定元素
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm'
            });

            form.on('radio(isPassTest)', function (data) {
                console.log(data.value); //被点击的radio的value值
                if (data.value == '2') {
                    $("#reasonDiv").css("display", "block");
                } else {
                    $("#reasonDiv").css("display", "none");
                }
            });


            //监听提交
            form.on('submit(add)',
                function (data) {
                    if ($("#Showwat").val() == '查看') {
                        xadmin.close()
                        return
                    }
                    event.preventDefault();
                    //获取到表单信息
                    var isPassTest = ""; //是否通过
                    var id = $("#id").val();
                    isPassTest = data.field.isPassTest; //获取是否通过
                    console.log(isPassTest, '1111111')

                    if (isPassTest == undefined) {
                        layer.alert("请选择是否通过")
                        return
                    } else if (isPassTest == 2) {
                        if ($("#reason").val() == "") {
                            layer.alert("请填写失败原因")
                            return;
                        } else {
                            requestAjax(2, $("#reason").val())
                            return
                        }
                    } else {
                        requestAjax(1, '')
                        return
                    }


                });

        });

    function requestAjax(isPass, cause) {
        //发异步，发数据
        $.ajax({
            type: "get",
            url: LL_updateAdminApprove,
            data: {
                swapId: $('#dataId').val(),
                isPass: isPass,
                cause: cause ? cause : ''
            },
            success: function (res) {
                console.log(res)
                if (res.msg == 0) {
                    layer.alert("操作成功", {
                        icon: 6
                    }, function () {
                        //关闭当前frame
                        xadmin.close();
                        // 可以对父窗口进行刷新
                        xadmin.father_reload();
                    });
                } else {
                    layer.alert(res.msg, function (index) {
                        if (res.msg == "s您当前暂未登录，请登录后在操作") {
                            parent.parent.window.location.href =
                                getRequestPrefix() +
                                "/footBallAdmin/login.html"
                            xadmin.close();
                        } else {
                            layer.close(index);
                        }
                    });
                }
            },
            error: function (error) {
                console.log(error)
            }
        })
    }
</script>
</body>

</html>